package spbun.fileclean.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * 进度扫描对话框
 * 
 * @author spbun
 *
 */
public class ScanDialog extends JDialog {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 5630679986276103924L;

	public ScanDialog(JFrame frame) {
		super(frame, true);
		initGui();
	}

	private void initGui() {

		this.setTitle("文件扫描");
		this.setLayout(new BorderLayout());

		initCenterPanel();
		initSouthPanel();

		this.setSize(400, 300);
	}

	private void initCenterPanel() {
		JPanel panel = new JPanel();

		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		this.add(panel, BorderLayout.NORTH);

		JPanel line1 = new JPanel(new FlowLayout(FlowLayout.LEADING));
		line1.add(new JLabel("扫描文件个数:"));
		line1.add(new JLabel("500"));
		panel.add(line1);

		panel.add(Box.createVerticalStrut(5));// 设置间距

		JPanel line2 = new JPanel(new FlowLayout(FlowLayout.LEADING));
		line2.add(new JLabel("扫描文件夹个数:"));
		line2.add(new JLabel("500"));
		panel.add(line2);
		panel.add(Box.createVerticalStrut(5));// 设置间距

		JPanel line3 = new JPanel(new FlowLayout(FlowLayout.LEADING));
		line3.add(new JLabel("扫描文件总大小:"));
		line3.add(new JLabel("500M"));
		panel.add(line3);
		panel.add(Box.createVerticalStrut(5));// 设置间距

		JPanel line4 = new JPanel(new BorderLayout());
		line4.add(new JLabel("当前扫描文件夹:"), BorderLayout.WEST);
		line4.add(new JLabel(
				"D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018"),
				BorderLayout.CENTER);
		panel.add(line4);

		panel.add(Box.createVerticalStrut(5));// 设置间距
		JPanel line5 = new JPanel(new BorderLayout());

		JPanel lblPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
		lblPanel.setBorder(BorderFactory.createLineBorder(Color.RED));
		lblPanel.add(new JLabel("当前扫描文件:"));
		line5.add(lblPanel, BorderLayout.WEST);
		line5.add(new JLabel(
				"D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018D:\\\\\\\\workspaces\\\\\\\\2018"),
				BorderLayout.CENTER);

		panel.add(line5);

	}

	private void initSouthPanel() {

		JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		this.add(panel, BorderLayout.SOUTH);

		panel.add(new JButton("取消"));
	}
}
